Skip to content

Encrypt/decrypt config#86

Merged
miguelgrubin merged 26 commits intomasterfrom
feature/added_crypt_options
Feb 21, 2020
Merged

Encrypt/decrypt config#86
miguelgrubin merged 26 commits intomasterfrom
feature/added_crypt_options

Conversation

@avara1986
Copy link
Member

@avara1986 avara1986 commented Feb 16, 2020

First approach to Issue #70

Features

  • New encryption and decryption feature with AES
  • Create a key to encrypt config with new command line pyms create-key
  • Encrypt a string with the new command line pyms encrypt [STRING]
  • Set the key file with new environment variable KEY_FILE
  • If you set in your config a var with the prefix "ENC_" or "enc_" PyMS search for the key file and decrypt the string. Now you can encrypt your database url for production environments. I.E.:
pyms:
[...]
  config:
    ENC_DATABASE: gAAAAABeSZ714r99iRIxhoH77vTdRJ0iqSymShfqgGN9PJveqhQWmshRDuV2a8sATey8_lHkln0TwezczucH-aJHGP_LyEiPxwM-88clNa7FB1u4g7Iaw3A=

you can access it in your code with current_app.config["DATABASE"] == "http://database-url"

Fixes

  • Send path to ConfFile from Microservice class to set path from code if you want to not use CONFIGMAP_FILE from env

Refactors

  • Refactor config. Menoize of files moved to new class

@avara1986 avara1986 added the feature New feature in progres label Feb 16, 2020
@coveralls
Copy link

coveralls commented Feb 16, 2020

Coverage Status

Coverage increased (+0.04%) to 99.753% when pulling 19745f7 on feature/added_crypt_options into 9a5e5e2 on master.

@alexppg
Copy link
Member

alexppg commented Feb 17, 2020

This is very cool! Would be some documentation on how to use it be out of the scope of this MR? I think it would help us a little bit to review it better.
I still don't understand where the key is and how does the micro know where it is.

@avara1986
Copy link
Member Author

This is very cool! Would be some documentation on how to use it be out of the scope of this MR? I think it would help us a little bit to review it better.
I still don't understand where the key is and how does the micro know where it is.

Ok @alexppg, i thought to create the PR and after merged, create the docs, but you're right, with the docs the PR will be more easy to understand, thanks!

@avara1986
Copy link
Member Author

Added doc @alexppg 👍

@alexppg
Copy link
Member

alexppg commented Feb 19, 2020

Awesome! Very well explained, thanks @avara1986 \o/

avara1986 and others added 9 commits February 19, 2020 09:09
Co-Authored-By: Àlex Pérez <alexperez@paradigmadigital.com>
Co-Authored-By: Àlex Pérez <alexperez@paradigmadigital.com>
Co-Authored-By: Àlex Pérez <alexperez@paradigmadigital.com>
Co-Authored-By: Àlex Pérez <alexperez@paradigmadigital.com>
Co-Authored-By: Àlex Pérez <alexperez@paradigmadigital.com>
Co-Authored-By: Àlex Pérez <alexperez@paradigmadigital.com>
Co-Authored-By: Àlex Pérez <alexperez@paradigmadigital.com>
@avara1986
Copy link
Member Author

It`s ok to merge @alexppg @miguelgrubin ?

@alexppg
Copy link
Member

alexppg commented Feb 21, 2020

Sure! Sorry for not saying explicitly LGTM. I was waiting to @miguelgrubin, to see if he does want to say something.

@miguelgrubin miguelgrubin merged commit cc95e01 into master Feb 21, 2020
@avara1986 avara1986 deleted the feature/added_crypt_options branch February 21, 2020 16:59
@avara1986 avara1986 linked an issue Mar 30, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature in progres

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Link on the py-ms doc

4 participants